
function yzShen() {
    $.getJSON("/wxw/selShen", function (data) {
        $(".yzShen").append("<option>" + data + "</option>");
    })
}
function yzgb() {

    let yzName=$(".yzName").val().trim();


    $.getJSON("/smc/ejld","yzName="+yzName,function (asd) {

            $(".yzDD").html("<option>" + asd + "</option>")

    })
}
function yongZhang() {
    let yzName =$(".yzName").val().trim();

    let yzTime = $(".yzTime").val().trim();
    let reason = $(".reason").val().trim();
    if(yzTime==""){
        layer.tips("请选择申请时间！", '.yzTime');
        return;
    }
    if(yzName==0){
        layer.tips("请选择用章类型！", '.yzName');
        return;
    }

    if(reason==""){
        layer.tips("请输入用章事由！", '.reason');
        return; 
    }

    let jsonA={
        d_id:yzName,
        yzTime:yzTime,
        reason:reason,
        // approver:yzShen
    }
    console.log(jsonA);
    $.ajaxSettings.async = false;
    $.getJSON("/smc/add",jsonA,function (dataA) {
        if(dataA){
            layer.alert('提交成功', {icon: 6});
        }else {
            layer.alert('提交失败', {icon: 5});
        }
        setTimeout("window.location.href='/smc/yongzhang'",2000);
    });
    $.ajaxSettings.async = true;
}
function mingpian() {
    let createTime =$(".createTime").val().trim();
    let phone =$(".phone").val().trim();
    let number = $(".number").val().trim();
    let reark=$(".reark").val().trim();
    let yzspbm=$(".yzspbm").val();

    if (createTime==""){
        layer.tips('请选择申请时间', '.createTime');
        return;
    }
    if(!(/^1[3456789]\d{9}$/.test(phone))){
        layer.tips("手机号码有误，请重填", '.phone');
        return false;
    }
    if(phone==""){
        layer.tips("请输入手机号！", '.phone');
        return;
    }
    if(number==""){
        layer.tips("请输入打印数量！", '.number');
        return;
    }
    if (isNaN(number)){
        layer.tips( "数量必须为数字", '.number' );
        return;
    }
    if (number<=0){
        layer.tips( "数量大于零！", '.number' );
        return;
    }
    if(reark==""){
        layer.tips("请输入备注！", '.reark');
        return;
    }
    // if(yzShen=="-1"){
    //     layer.tips("请选择审批人！", '.yzShen',{
    //         tips: 3
    //     });
    //
    //     return;
    // }

    let jsonB={
        createTime:createTime,
        phone:phone,
        number:number,
        reark:reark,
        approver:yzspbm
        // approver:yzShen,
    }
    console.log(jsonB);
    $.ajaxSettings.async = false;
    $.getJSON("/smc/addmp",jsonB,function (dataB) {
        if(dataB){
            layer.alert('提交成功', {icon: 6});
        }else {
            layer.alert('提交失败', {icon: 5});
        }
        setTimeout("window.location.href='/to/mingpian'",2000);
    });
    $.ajaxSettings.async = true;
}
